#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007

long long quick_pow(long long x, long long n, long long m)
{
    long long res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * x % m;
        x = x * x % m;
        n >>= 1;
    }
    return res;
}

long long p[1000001];

long long C(long long a, long long b)
{
    if (b == 0)
        return 1;
    return p[a] * quick_pow(p[b] * p[a - b] % MOD, MOD - 2, MOD) % MOD;
}

int a[100001];

int main()
{
    int n, ans = 1;
    cin >> n;
    cin >> a[1];
    p[1] = p[0] = 1;
    for (int i = 2; i <= 1000000; i++)
        p[i] = p[i - 1] * i % MOD;
    for (int i = 2; i <= n; i++) {
        cin >> a[i];
        if (a[i - 1] > a[i])
            ans = ans * C(a[i - 1] / 2, a[i] / 2) % MOD;
        else
            ans = ans * C(a[i] / 2 - 1, (a[i] - a[i - 1]) / 2) % MOD;
    }
    cout << ans;
}